package com.xszx.controller;

import com.xszx.beans.User;
import com.xszx.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.io.FileNotFoundException;

/**
 * @Author 信思智学
 * @Date 2024/8/20 9:34
 * @Description 组件
 * <bean id="userController" class="com.xszx.controller.UserController"></bean>
 */
@Controller
public class UserController {

    private UserService userService;

    @Resource
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    @RequestMapping("/addUser")
    public String addUser(User user) throws Exception {
        //调用业务层
        userService.addUser(user);
        //转发或者重定向
        return "index";
    }



}
